#include<bits/stdc++.h>

using namespace std;
using ll = long long;
#define endl '\n'
const int maxn = 2000000 + 1;
int dp[maxn], phi[maxn];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        dp[i] = i;
    }

    for (int i = 2; i * i <= n; i++) {
        if (dp[i]==i) {
            for (int j = i * i; j <= n; j += i) {
                dp[j] = i;
            }
        }
    }
    phi[1] = 1;
    for (int i = 2; i <= n; i++) {
        phi[i] = phi[i / dp[i]];
        if ((i / dp[i]) % dp[i] == 0) {
            phi[i] *= dp[i];
        } else {
            phi[i] *= dp[i] - 1;
        }

    }
    cout << phi[n] << endl;
    return 0;
}
